%This file is deprecated and can be run instead of CIPGraph3MEURCHF if data
%for CHF/USD is not available or not necessary (can save time)

functionFolder = cd('..');

opts = spreadsheetImportOptions("NumVariables", 17);

% Specify sheet and range
opts.Sheet = "Sheet2";
opts.DataRange = "A2:Q3392";

% Specify column names and types
opts.VariableNames = ["VarName1", "MTBills", "EURSpot", "Euro3MForward", "MEURGerman", "AUDSpot", "AUD3MForward", "AUD3MYield", "CADSpot", "CAD3MForward", "CAD3MYield", "GBPSpot", "GBP3MForward", "GBP3MYield", "JPYSpot", "JPY3MForward", "JPY3MYield"];
opts.VariableTypes = ["datetime", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double"];

% Specify variable properties
opts = setvaropts(opts, "VarName1", "InputFormat", "");

% Import the data
oldFolder = cd('input\');
CIPAllS1 = readtable("CIPAll.xlsx", opts, "UseExcel", false);
cd(functionFolder);

% Clear temporary variables
clear opts
%Build 
CIPVecEUR = CIPAllS1{:,[3 4 2 5]};
CIPCalcEUR = (CIPVecEUR(:,1)./CIPVecEUR(:,2)).*(1./(1+CIPVecEUR(:,4)./100)).^0.25 - (1./(1+CIPVecEUR(:,3)./100)).^0.25;
CIPVecAUD = CIPAllS1{:,[6 7 2 8]};
CIPCalcAUD = (CIPVecAUD(:,1)./CIPVecAUD(:,2)).*(1./(1+CIPVecAUD(:,4)./100)).^0.25 - (1./(1+CIPVecAUD(:,3)./100)).^0.25;
CIPVecCAD = CIPAllS1{:,[9 10 2 11]};
CIPCalcCAD = (CIPVecCAD(:,1)./CIPVecCAD(:,2)).*(1./(1+CIPVecCAD(:,4)./100)).^0.25 - (1./(1+CIPVecCAD(:,3)./100)).^0.25;
CIPVecGBP = CIPAllS1{:,[12 13 2 14]};
CIPCalcGBP = (CIPVecGBP(:,1)./CIPVecGBP(:,2)).*(1./(1+CIPVecGBP(:,4)./100)).^0.25 - (1./(1+CIPVecGBP(:,3)./100)).^0.25;
CIPVecJPY = CIPAllS1{:,[15 16 2 17]};
CIPCalcJPY = (CIPVecJPY(:,1)./CIPVecJPY(:,2)).*(1./(1+CIPVecJPY(:,4)./100)).^0.25 - (1./(1+CIPVecJPY(:,3)./100)).^0.25;

%Now plot CIP
t = [CIPCalcEUR CIPCalcAUD CIPCalcCAD CIPCalcGBP CIPCalcJPY];
plot(t);



